package com.yx.controller;

import com.yx.service.ISearchGoodsService;
import com.yx.vo.Goods;
import com.yx.vo.SearchGoodsParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.io.IOException;
import java.util.List;

/**
 * @Classname SearchGoodsController
 * @Date 2021/07/12 19:02
 * @Author by yx
 * @Description TODO:
 */
@Controller
@RequestMapping("/searchGoodsController")
public class SearchGoodsController {

    @Autowired
    private ISearchGoodsService searchGoodsService;

    @RequestMapping("/search")
    public String search(SearchGoodsParam param, ModelMap modelMap) throws IOException {
        List<Goods> search = searchGoodsService.search(param);
        modelMap.put("goodsList", search);
        return "searchList";
    }
}
